import book.Booklist;
import user.Administrator;
import user.Normal;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的名字");
        String name = sc.nextLine();
        System.out.println("欢迎 " + name + " ,请选择：0->管理员  1->普通用户");
        int choice = sc.nextInt();
        if (choice == 1){
            return new Normal(name);
        }else{
            return new Administrator(name);
        }
    }

    public static void main(String[] args) {
        Booklist booklist = new Booklist();
        User user = login();
        while(true) {
            int choice = user.menu();
            user.choices(choice, booklist);
        }
    }
}
